//
//  WPTreamentSectionHeaderView.m
//  wobingwoyi
//
//  Created by WGP on 2016/12/1.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPTreamentSectionHeaderView.h"

@interface WPTreamentSectionHeaderView ()

@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIImageView *lineImageView;

@end
@implementation WPTreamentSectionHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        UIImageView *topLine = [UIImageView lineImageView];
        UIImageView *bottomLine = [UIImageView lineImageView];
        [self.contentView addSubview:topLine];
        [self.contentView addSubview:bottomLine];
        
        [topLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(self.contentView);
            make.height.mas_equalTo(0.5);
        }];
        
        [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self.contentView);
            make.height.mas_equalTo(0.5);
        }];
        
        
        [self titleLabel];
        
    }
    return self;
}
-(UIImageView *)lineImageView
{
    if (_lineImageView == nil)
    {
        _lineImageView = [[UIImageView alloc] init];
        _lineImageView.backgroundColor = GlobalColor;
        [self.contentView addSubview:_lineImageView];
        
        [_lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(10);
            make.width.mas_equalTo(1);
            make.height.mas_equalTo(24);
            make.centerY.equalTo(self.contentView);
        }];
    }
    return _lineImageView;
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil)
    {
        _titleLabel = [UILabel new];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        _titleLabel.textColor = GLobalFontColor;
        [self.contentView addSubview:_titleLabel];
        
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.lineImageView.mas_right).offset(10);
            make.centerY.equalTo(self.contentView);
        }];
    }
    return _titleLabel;
}

-(void)setTime:(NSString *)time
{
    _time = time;
    
    self.titleLabel.text = time;
}

@end
